package com.daylive.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



import com.daylive.dao.AgentDao;
import com.daylive.model.Agent;
import com.daylive.page.Page;


@Service
public class AgentService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private AgentDao agentDao;
	
	public Page<Agent> getAgentList(String companyName,int pageNumber) {
		Page<Agent> page = new Page<Agent>(pageNumber, PAGE_SIZE);
		List<Agent> list = agentDao.getAgentList(companyName, page);
		page.setResultList(list);
		return page;
	}
	public List<Agent> getAgentList() {
		List<Agent> list = agentDao.getAgentList();
		return list;
	}
	public Agent getAgentById(int id) {
		return agentDao.getAgentById(id);
	}
	public int addAgent(Agent agent) {
		return agentDao.addAgent(agent);
	}
	public int updateAgent(Agent agent) {
		return agentDao.updateAgent(agent);
	}
	public int delAgent(int id) {
		return agentDao.delAgent(id);
	}
	public int delAll(String[] ids) {
		return agentDao.delAll(ids);
	}

}
